﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GuanLongHooker
{
    class UserManager
    {
        //目前硬编码在类中, 以后要写从XML读出

        private static _User user1 = new _User("158000000281010", "111111", false);//以后要写从XML读出
        private static _User user2 = new _User("158000000141833", "111111", false);//以后要写从XML读出
        private static _User user3 = new _User("158001000010311", "141833", true);//以后要写从XML读出

        private static _User[] users = { user1, user2, user3 };

        public static bool checkUser(string userId)
        {
            //根据已经定义的用户, 判断是实盘还是模拟盘
            bool rt = false;

            foreach (_User user in users)
            {
                if (userId != null && userId.Length > 0 && userId.Equals(user.userId))
                {
                    rt = user.isReal;
                    break;
                }
            }

            return rt;
        }

        private class _User
        {
            public _User()
            { }

            public _User(string userId, string pwd, bool isReal)
            {
                this.userId = userId;//用户账户
                this.pwd = pwd;//密码
                this.isReal = isReal;//是否实盘
            }
            public string userId = "";
            public string pwd = "";
            public bool isReal;
        }
    }
}
